﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Handrise.CDCable.Mobile.Business
{
    /// <summary>
    /// 设备类型服务
    /// </summary>
    public class EquipmentTypeService
    {
        /// <summary>
        /// 获取所有设备类型
        /// </summary>
        /// <returns></returns>
        public List<EquipmentType> GetAllEquipmentType()
        {
            return AppLogic.dataService.Find<EquipmentType>("", "FORDER");
        }

        /// <summary>
        /// 获取设备位置:GPS(地上)、WIFI(地下)
        /// </summary>
        /// <param name="deviceType"></param>
        /// <returns></returns>
        public string GetDeviceLocate(string deviceType)
        {
            EquipmentType equipmentType = AppLogic.dataService.GetFirstEntity<EquipmentType>("FTYPENAME = '" + deviceType + "'", "");
            if (equipmentType == null)
                return "";
            return equipmentType.COORD;
        }

        /// <summary>
        /// 获取设备类型所属的大类
        /// </summary>
        /// <param name="deviceType"></param>
        /// <returns></returns>
        public string GetDeviceLargeType(string deviceType)
        {
            EquipmentType equipmentType = AppLogic.dataService.GetFirstEntity<EquipmentType>("FTYPENAME = '" + deviceType + "'", "");
            if (equipmentType == null)
                return "";
            return equipmentType.FCATEGORY;
        }
    }
}
